{% extends 'myadmin/index.html' %}

{% block title %}
    <title>后台-订单列表</title>
{% endblock %}

{% block con %}
<div class="row-content am-cf">
    <div class="row">
        <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
            <div class="widget am-cf">
                <div class="widget-head am-cf">
                    <div class="widget-title  am-cf">订单列表</div>
                </div>
                <div class="widget-body  am-fr">

                    <div class="am-u-sm-12 am-u-md-6 am-u-lg-6">
                        <div class="am-form-group">
                            <div class="am-btn-toolbar">
                                
                            </div>
                        </div>
                    </div>
                    <form>
                        <div class="am-u-sm-12 am-u-md-6 am-u-lg-3">
                            <div class="am-form-group tpl-table-list-select">
                                <select name="types" data-am-selected="{btnSize: 'sm'}" style="display: none;">
                                  <option value="all" {% if request.GET.types == 'all' %} selected {% endif %}>所有类别</option>
                                  <option value="wl" {% if request.GET.types == 'wl' %} selected {% endif %}>物流方式</option>
                                  <option value="buytype" {% if request.GET.types == 'type' %} selected {% endif %}>支付方式</option>
                                  <option value="status" {% if request.GET.types == 'status' %} selected {% endif %}>订单状态</option>
                                  
                                </select>
                            </div>
                        </div>
                        <div class="am-u-sm-12 am-u-md-12 am-u-lg-3">
                            <div class="am-input-group am-input-group-sm tpl-form-border-form cl-p">
                                <input type="text" value="{{ request.GET.keywords }}" name="keywords" class="am-form-field ">
                                <span class="am-input-group-btn">
                                    <button class="am-btn  am-btn-default am-btn-success tpl-table-list-field am-icon-search"></button>
                                  </span>
                            </div>
                        </div>
                    </form>

                    <div class="am-u-sm-12">
                        <table width="100%" class="am-table am-table-compact am-table-striped tpl-table-black ">
                            <thead>
                                <tr>
                                    <th>ID</th>
                                    <th>收货人</th>
                                    <th>收货电话</th>
                                    <!-- <th>收货地址</th> -->
                                    <th>物流方式</th>
                                    <th>支付方式</th>
                                    <th>总价</th>
                                    <th>订单状态</th>
                                    <th>注册时间</th>
                                    <th>操作</th>
                                </tr>
                            </thead>
                            <tbody>
                                {% for v in data %}
                                <tr>
                                    <td>{{ v.id }}</td>
                                    <td class="am-text-middle">{{ v.shr }}</td>
                                    <td class="am-text-middle">{{ v.shdh }}</td>
                                    <!-- <td class="am-text-middle">{{ v.shdz }}</td> -->
                                    <td class="am-text-middle">{{ v.wl }}</td>
                                    <td class="am-text-middle">{{ v.buytype }}</td>
                                    <td class="am-text-middle">{{ v.totalprice }}</td>
                                    <td class="am-text-middle">
                                        <span style="display: none;">{{v.id}}</span>
                                            <select name="status" class="status" id="" style="color:black">
                                                <option value="0" {% if v.status == 0 %} selected {% endif %}>新订单</option>
                                                <option value="1" {% if v.status == 1 %} selected {% endif %}>未支付</option>
                                                <option value="2" {% if v.status == 2 %} selected {% endif %}>已支付,待发货</option>
                                                <option value="3" {% if v.status == 3 %} selected {% endif %}>已发货,待收货</option>
                                                <option value="4" {% if v.status == 4 %} selected {% endif %}> 待评价</option>
                                                <option value="5" {% if v.status == 5 %} selected {% endif %}> 已删除</option>                       
                                            </select>
                                    </td>
                                    <td class="am-text-middle">{{ v.addtime }}</td>
                                    <td class="am-text-middle">
                                        <div class="tpl-table-black-operation">
                                            <a href="{% url 'myadmin_order_info' %}?oid={{ v.id }}" class="tpl-table-black-operation-del">
                                                <i class="am-icon-pencil"></i> 查看详情
                                            </a>
                                           <!--  <a href="" class="tpl-table-black-operation-del">
                                                <i class="am-icon-trash"></i> 删除
                                            </a> -->
                                        </div>
                                    </td>
                                </tr>
                                {% endfor %}
                      
                                <!-- more data -->
                            </tbody>
                        </table>
                    </div>
                    <div class="am-u-lg-12 am-cf">

                        <div class="am-fr">
                            <ul class="am-pagination tpl-pagination">
                            
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    $('.status').change(function(){
        //获取当前元素的id编号
        var id=$(this).prev().text()
        var status=$(this).val()
        $.get('{% url 'myadmin_order_edit' %}',{'id':id,'status':status},function(data){if(data['error']==1){alert(data['msg'])}},'json')
    })
</script>
{% endblock %}